//
//  LGSearchCell.m
//  celltest
//
//  Created by guomianxiang on 2017/4/7.
//  Copyright © 2017年 guomianxiang. All rights reserved.
//

#import "LGSearchCell.h"
#import "LGSearchResultVC.h"
#import "LGtools.h"

@interface LGSearchCell()
@property (strong, nonatomic) LGSearchResultVC *resultVC;
@property (strong, nonatomic) UISearchController *searchC;
@end

@implementation LGSearchCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundColor = [UIColor clearColor];
    self.searchBar.hidden = YES;
    UIStoryboard *doorSB = [UIStoryboard storyboardWithName:@"DoorController" bundle:[NSBundle mainBundle]];
    self.resultVC = [doorSB instantiateViewControllerWithIdentifier:NSStringFromClass([LGSearchResultVC class])];
    self.searchC = [[UISearchController alloc]initWithSearchResultsController:_resultVC];
    self.searchC.searchResultsUpdater = self.resultVC;
    self.searchC.delegate = self.resultVC;
    self.searchC.searchBar.frame = CGRectMake(0, 0, kScreen_W, 44);
    [self.searchC.searchBar setTintColor:kColorFromRGB(0x3FEDEB)];
    CGFloat value = 0.85;
    [self.searchC.searchBar setBarTintColor:[UIColor colorWithRed:value green:value blue:value alpha:1.00]];

    
    [self.contentView addSubview:self.searchC.searchBar];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
